/**
 * Copyright (C) 2018-2022
 * All rights reserved, Designed By www.dynread.com
 * 注意：
 * 本软件为www.dynread.com开发研制，项目使用请保留此说明
 */
package com.dynread.mall.entity;

import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.dynread.common.core.domain.BaseModel;
import com.dynread.common.sensitive.Sensitive;
import com.dynread.common.sensitive.SensitiveTypeEnum;
import com.dynread.mall.enums.OrderLogisticsEnum;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;

/**
 * 订单物流
 *
 * @author drinvay
 * @date 2022/5/6 17:45
 */
@Data
@TableName("order_logistics")
@EqualsAndHashCode(callSuper = true)
@ApiModel(description = "订单物流")
public class OrderLogistics extends BaseModel {
    private static final long serialVersionUID = 1L;

    /**
     * 邮编
     */
    @ApiModelProperty(value = "邮编")
    private String postalCode;

    /**
     * 收货人
     */
    @ApiModelProperty(value = "收货人")
    private String userName;

    /**
     * 电话号码
     */
    @ApiModelProperty(value = "电话号码")
    @Sensitive(type = SensitiveTypeEnum.MOBILE_PHONE)
    private String telNum;

    /**
     * 详细地址
     */
    @ApiModelProperty(value = "详细地址")
    private String address;

    /**
     * 物流商家
     */
    @ApiModelProperty(value = "物流商家")
    private String logistics;

    /**
     * 物流商家
     */
    @TableField(exist = false)
    private String logisticsDesc;

    public String getLogisticsDesc() {
        if (this.logistics == null) {
            return null;
        }
        return OrderLogisticsEnum.valueOf(OrderLogisticsEnum.LOGISTICS_PREFIX + "_" + StrUtil.swapCase(this.logistics)).getDesc();
    }

    /**
     * 物流单号
     */
    @ApiModelProperty(value = "物流单号")
    private String logisticsNo;

    /**
     * 快递单当前状态（-1错误 0在途 1揽收 2疑难 3签收 4退签 5派件 6退回 7转投）
     */
    @ApiModelProperty(value = "快递单当前状态（-1错误 0在途 1揽收 2疑难 3签收 4退签 5派件 6退回 7转投）")
    private String status;

    /**
     * 快递单当前状态（-1错误 0在途 1揽收 2疑难 3签收 4退签 5派件 6退回 7转投）
     */
    @TableField(exist = false)
    private String statusDesc;

    public String getStatusDesc() {
        if (this.status == null) {
            return null;
        }
        return OrderLogisticsEnum.valueOf(OrderLogisticsEnum.STATUS_PREFIX + "_" + this.status).getDesc();
    }

    /**
     * 签收标记（0未签收 1已签收）
     */
    @ApiModelProperty(value = "签收标记（0未签收 1已签收）")
    private String isCheck;

    /**
     * 相关信息
     */
    @ApiModelProperty(value = "相关信息")
    private String message;

    /**
     * 物流详情
     */
//	@TableField(exist = false)
//	private List<OrderLogisticsDetail> listOrderLogisticsDetail;

	@TableField(exist = false)
	private String createBy;
	@TableField(exist = false)
	private String updateBy;
}
